import org.junit.jupiter.api.Test;

public class _09_回文数 {


    @Test
    void test(){
        System.out.println(isPalindrome(121));
    }
    public boolean isPalindrome(int x) {
        String s = String.valueOf(x);
//        StringBuilder stringBuilder=new StringBuilder(s);
//        if (stringBuilder.reverse().toString().equals(s)){
//            return true;
//        }else {
//            return false;
//        }

        int left=0;
        int right=s.length()-1;
        char[] chars = s.toCharArray();
        while (left<right) {
            if (chars[left]!=chars[right]){
                return false;
            }
            left++;
            right--;

        }
        return true;
    }
}
